#pragma once

#include <iostream>

#ifdef WIN32
#include <Windows.h>

#define CLOSE_SOCKET(S) closesocket(S)
#define STARTUP(version, data) WSAStartup(version, data)
#else
#include <netdb.h>
#include <arpa/inet.h>
#define CLOSE_SOCKET(S) close(S)
#define STARTUP(version, data) 0
#endif

#include "Types.h"

class Udp
{
public:
	Udp(std::string, int);
	~Udp(void);
    
    abyte* Receive(abyte*, int);
    void Send(abyte*, int);

private:
	struct sockaddr_in remote_;
    int socket_;
    bool is_bound_;

    bool Bind();
	void PrintAddress(const sockaddr_in*);
};

